/**
 * 客户状态
 */
//查看客户信息
function viewCustom(id){
	//window.location.href="customer/view?id="+id;
	$('#formbox').dialog({
		title : '客户明细',
		height: 600,
		width:'100%',
		closed : false,
		cache : false,
		href : "customer/view?id="+id,
		modal : true
	});
}

//修改客户状态
function updateCustomerStatus(id,status,customname){
	if(status == 1){
		$.messager.confirm('确认', "确定要停用【"+customname+"】这个客户吗？", function(r){
			if (r){
				$.post("customer/status/update",{'id':id,'customstatus':status},function(result){
					if("success" == result){
						$.messager.alert('提示','停用成功!','info');
						$("#customer_dg").datagrid("reload");
					}else{
						$.messager.alert('提示','停用失败!','error');
					}
				},'text');
			}
		});
	}else{
		$.messager.confirm('确认', "确定要启用【"+customname+"】这个客户吗？", function(r){
			if (r){
				$.post("customer/status/update",{'id':id,'customstatus':status},function(result){
					if("success" == result){
						$.messager.alert('提示','启用成功!','info');
						$("#customer_dg").datagrid("reload");
					}else{
						$.messager.alert('提示','启用失败!','error');
					}
				},'text');
			}
		});
	}
}

//修改客户
function updateCustom(id){
	$('#formbox').dialog({
		title : '修改客户',
		height: 600,
		width:900,
		closed : false,
		cache : false,
		href : "customer/update?id="+id,
		modal : true,
		buttons:[{
			text:'修  改',
			handler:function(){
				saveCustomer();
			}
		},{
			text:'取  消',
			handler:function(){
				$('#formbox').dialog('close');
			}
		}]
	});
}